<template>
	<view class="container">

		<view class="charts-box">
			<qiun-data-charts type="arcbar" :opts="opts" :chartData="chartData" n/>
		</view>
		<!-- 分类 -->
		<view class="cate-section">

			<navigator url="/pages/order/add/add" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/添加库存.png"></image>
					<text>添加库存</text>
				</view>
			</navigator>

			<navigator url="/pages/order/manage/manage" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/库存管理.png"></image>
					<text>库存管理</text>
				</view>
			</navigator>

			<navigator url="/pages/order/send/send" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/订单管理.png"></image>
					<text>发货管理</text>
				</view>
			</navigator>

			<navigator url="/pages/order/in_out/in_out" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/进出货管理.png"></image>
					<text>进出货记录</text>
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				chartData: {
				},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['arcbar'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts: {
					color: ["#3CA272","#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: undefined,
					title:{
						name:"45%",
						fontSize: 35,
						color: "#EE6666"
					},
					subtitle: {
						name: "库存剩余",
						fontSize: 25,
						color: "#666666"
					},
					extra: {
						arcbar: {
							type: "default",
							width: 50,
							backgroundColor: "#E9E9E9",
							startAngle: 0.75,
							endAngle: 0.25,
							gap: 2,
							linearType: "custom"
						}
					}
				},
				texts: [],
			};
		},
		onReady() {
			this.getServerData();
		},
		methods: {
			getServerData() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						series: [{
							color: "#ff0000",
							data: 0.45,
							name:"45%"
						}
						]
					};
					this.chartData = JSON.parse(JSON.stringify(res));
				}, 500);
			},
		}
	};
</script>

<style lang="scss">
	/* 请根据实际需求修改父元素尺寸，组件自动识别宽高 */
	.charts-box {
		width: 100%;
		height: 300px;
	}

	/* #ifdef MP */
	page {
		.cate-section {
			position: relative;
			z-index: 5;
			border-radius: 16upx 16upx 0 0;
			margin-top: -20upx;
		}

		.carousel-section {
			padding: 0;

			.titleNview-placing {
				padding-top: 0;
				height: 0;
			}

			.carousel {
				.carousel-item {
					padding: 0;
				}
			}

			.swiper-dots {
				left: 45upx;
				bottom: 40upx;
			}
		}
	}

	/* #endif */


	page {
		background: #f5f5f5;
	}




	/* 分类 */
	.cate-section {
		display: flex;
		justify-content: space-around;
		align-items: center;
		flex-wrap: wrap;
		padding: 30upx 22upx;
		background: #fff;

		.cate-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			font-size: $font-sm + 2upx;
			color: $font-color-dark;
		}

		/* 原图标颜色太深,不想改图了,所以加了透明度 */
		image {
			width: 88upx;
			height: 88upx;
			margin-bottom: 14upx;
			border-radius: 50%;
			opacity: .7;
			box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
		}
	}

	/* 请根据实际需求修改父元素尺寸，组件自动识别宽高 */
	.charts-box {
		width: 100%;
		height: 300px;
	}
</style>
